package cn.topcodes.tcsf.app.service;

import cn.topcodes.tcsf.admin.commons.generic.IGenericService;
import cn.topcodes.tcsf.app.domain.entity.DailyActiveUsers;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

/**
 * 用户日活量数据服务
 */
public interface DailyActiveUsersService extends IGenericService<DailyActiveUsers> {

    /**
     * 记录用户活跃
     * @param app
     * @param appUserId
     */
    @Transactional(readOnly = false, rollbackFor = Exception.class)
    void record(String app, Long appUserId);

    /**
     * 记录用户活跃
     * @param appUserId
     */
    @Transactional(readOnly = false, rollbackFor = Exception.class)
    void record(Long appUserId);

    /**
     * 查询用户在指定时段的活跃情况
     * @param appUserId app用户ID
     * @param start     开始时间
     * @param end       结束时间
     * @return
     */
    List<DailyActiveUsers> findBy(Long appUserId, Date start, Date end);
}
